import Router from "vue-router"
import Vue from "vue"
import ArticleCard from './components/ArticleCard.vue'
import ClassifyCard from './components/ClassifyCard.vue'
import LinkCard from './components/LinkCard.vue'
import UserCard from './components/UserCard.vue'
import RecommendCard from './components/RecommendCard.vue'
import ArticleContentCard from './components/ArticleContentCard.vue'
import ArticleEdit from './components/ArticleEdit.vue'
import Home from './components/Home.vue'
import TimeLineCard from './components/TimeLineCard.vue'
import LoginCard from './components/LoginCard.vue'
import AboutCard from './components/AboutCard.vue'
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

export default new Router({
    routes: [
        {
            path: "/",
            name: 'home',
            component: Home,
            children: [
                {
                    path: '/',
                    name: 'home',
                    component: ArticleCard
                },
                {
                    path: '/timeline',
                    name: 'timeline',
                    component: TimeLineCard
                },
                {
                    path: '/article/:articleId',
                    name: "article",
                    component: ArticleContentCard,
                    props: true
                },
                {
                    path: '/classify',
                    name: 'classify',
                    component: ClassifyCard,
                },
                {
                    path: '/about',
                    name: 'about',
                    component: AboutCard
                }
            ]
        },
        {
            path: '/md',
            name: 'md',
            component: ArticleEdit
        },
        {
            path: '/login',
            name: 'login',
            component: LoginCard

        }
    ]
})